package com.tbit.uqbike.object.pojo;

import com.tbit.uqbike.annos.Excel;
import com.tbit.uqbike.object.value.Page;
import com.tbit.uqbike.webmanager.util.csv.annotations.Csv;
import com.tbit.uqbike.webmanager.util.csv.annotations.Sum;
import lombok.Data;

import java.util.Date;

@Data
public class RideLog {

    /**
     * 订单编号
     */
    @Csv(name = "订单编号")
    @Excel(name = "订单编号", sort = 1)
    private String orderno;

    /**
     * 退款状态(0 退款中)
     */
    private Integer refundStatus;

    /**
     * 用户id
     */
    private Integer userid;

    /**
     * 运营区域id
     */
    private Integer accountid;

    /**
     * 设备id
     */
    private Integer machineid;

    /**
     * 设备编号
     */
    @Csv(name = "设备编号")
    @Excel(name = "设备编号", sort = 2)
    private String machineno;

    /**
     * 车辆编号
     */
    @Csv(name = "车辆编号")
    @Excel(name = "车辆编号", sort = 3)
    private String usercode;

    /**
     * 开始时间
     */
    @Csv(name = "开始时间")
    @Excel(name = "开始时间", sort = 4, dateFormat = "yyyy-MM-dd HH:mm:ss")
    private Date starttime;

    /**
     * 结束时间
     */
    @Csv(name = "结束时间")
    @Excel(name = "结束时间", sort = 5, dateFormat = "yyyy-MM-dd HH:mm:ss")
    private Date endtime;

    /**
     * 停车时长(分钟)
     */
    @Csv(name = "停车时长(分钟)")
    @Excel(name = "停车时长(分钟)", sort = 6)
    private Integer stoptime;

    /**
     * 骑行里程(公里)
     */
    @Csv(name = "骑行里程(公里)")
    @Excel(name = "骑行里程(公里)", sort = 7)
    private Double mileage;

    /**
     * 消费总金额(分)
     */
    @Sum
    @Excel(name = "消费总金额(分)", sort = 8)
    private Integer money;

    @Sum
    @Csv(name = "消费总金额(元)")
    private Double moneyYuan;

    /**
     * 扣费详情
     */
    private String details;

    /**
     * 支付时间
     */
    @Csv(name = "支付时间")
    @Excel(name = "支付时间", sort = 9, dateFormat = "yyyy-MM-dd HH:mm:ss")
    private Date paytime;

    /**
     * 备注
     */
    @Csv(name = "备注")
    @Excel(name = "备注", sort = 10)
    private String remark;

    /**
     * 手机号码
     */
    @Csv(name = "手机号码")
    @Excel(name = "手机号码", sort = 11)
    private String phone;

    private Integer quantity;

    /**
     * 页码
     */
    private Integer pageNO;

    /**
     * 条数
     */
    private Integer rowCount;

    private Page page;

    /**
     * 操作密钥
     */
    private String operaPsw;
    /**
     * 用户订单修改前的金额
     */
    private Integer userMoney;

    @Csv(name = "借车点")
    @Excel(name = "借车点", sort = 12)
    private String startName;

    @Csv(name = "还车点")
    @Excel(name = "还车点", sort = 13)
    private String endName;

    private Integer regionId;

    private Integer endPointId;

    private Integer refundType;

    private String accountName;

    /**
     * 退款金额
     */
    private Integer refundMoney;

    /**
     * 用户名
     */
    private String userName;

    private Integer startPointId;

    public String getUserName() {
        return userName;
    }

    public void setUserName(String userName) {
        this.userName = userName;
    }

    public Integer getRefundMoney() {
        return refundMoney;
    }

    public void setRefundMoney(Integer refundMoney) {
        this.refundMoney = refundMoney;
    }

    public Integer getRefundType() {
        return refundType;
    }

    public void setRefundType(Integer refundType) {
        this.refundType = refundType;
    }

    public String getStartName() {
        return startName;
    }

    public void setStartName(String startName) {
        this.startName = startName;
    }

    public String getEndName() {
        return endName;
    }

    public void setEndName(String endName) {
        this.endName = endName;
    }

    public Integer getUserMoney() {
        return userMoney;
    }

    public void setUserMoney(Integer userMoney) {
        this.userMoney = userMoney;
    }

    public String getOperaPsw() {
        return operaPsw;
    }

    public void setOperaPsw(String operaPsw) {
        this.operaPsw = operaPsw;
    }

    public Page getPage() {
        return page;
    }

    public void setPage(Page page) {
        this.page = page;
    }

    public Integer getPageNO() {
        return pageNO;
    }

    public void setPageNO(Integer pageNO) {
        this.pageNO = pageNO;
    }

    public Integer getRowCount() {
        return rowCount;
    }

    public void setRowCount(Integer rowCount) {
        this.rowCount = rowCount;
    }

    public Integer getQuantity() {
        return quantity;
    }

    public void setQuantity(Integer quantity) {
        this.quantity = quantity;
    }

    public String getOrderNO() {
        return orderno;
    }

    /**
     * 两个get方法 用于解决反射字段名问题。
     */
    public String getOrderno() {
        return orderno;
    }

    public void setOrderno(String orderno) {
        this.orderno = orderno == null ? null : orderno.trim();
    }

    public Integer getUserid() {
        return userid;
    }

    public void setUserid(Integer userid) {
        this.userid = userid;
    }

    public Integer getAccountid() {
        return accountid;
    }

    public void setAccountid(Integer accountid) {
        this.accountid = accountid;
    }

    public Integer getMachineid() {
        return machineid;
    }

    public void setMachineid(Integer machineid) {
        this.machineid = machineid;
    }

    public String getUsercode() {
        return usercode;
    }

    public void setUsercode(String usercode) {
        this.usercode = usercode == null ? null : usercode.trim();
    }

    public Date getStarttime() {
        return starttime;
    }

    public void setStarttime(Date starttime) {
        this.starttime = starttime;
    }

    public Date getEndtime() {
        return endtime;
    }

    public void setEndtime(Date endtime) {
        this.endtime = endtime;
    }

    public Integer getStoptime() {
        return stoptime;
    }

    public void setStoptime(Integer stoptime) {
        this.stoptime = stoptime;
    }

    public Date getPaytime() {
        return paytime;
    }

    public void setPaytime(Date paytime) {
        this.paytime = paytime;
    }

    public String getMachineno() {
        return machineno;
    }

    public void setMachineno(String machineno) {
        this.machineno = machineno == null ? null : machineno.trim();
    }

    public Integer getUserId() {
        return userid;
    }

    public Integer getAccountId() {
        return accountid;
    }

    public Integer getMachineId() {
        return machineid;
    }

    public String getMachineNO() {
        return machineno;
    }

    public String getUserCode() {
        return usercode;
    }

    public Date getStartTime() {
        return starttime;
    }

    public Date getEndTime() {
        return endtime;
    }

    public Integer getStopTime() {
        return stoptime;
    }

    public Double getMileage() {
        return mileage;
    }

    public void setMileage(Double mileage) {
        this.mileage = mileage;
    }

    public Integer getMoney() {
        return money;
    }

    public void setMoney(Integer money) {
        this.money = money;
    }

    public String getDetails() {
        return details;
    }

    public void setDetails(String details) {
        this.details = details == null ? null : details.trim();
    }

    public Date getPayTime() {
        return paytime;
    }

    public String getRemark() {
        return remark;
    }

    public void setRemark(String remark) {
        this.remark = remark == null ? null : remark.trim();
    }

    public String getPhone() {
        return phone;
    }

    public void setPhone(String phone) {
        this.phone = phone;
    }

    public Integer getRegionId() {
        return regionId;
    }

    public void setRegionId(Integer regionId) {
        this.regionId = regionId;
    }

    public Integer getEndPointId() {
        return endPointId;
    }

    public void setEndPointId(Integer endPointId) {
        this.endPointId = endPointId;
    }

    // 获取骑行时长，单位分钟，根据自身情况就可以计算，不需要独立一个属性，增加一个get方法，json 库会检测到
    public Integer getRideTime() {
        if (null != endtime && null != starttime) {
            Integer integer = (int) ((endtime.getTime() - starttime.getTime()) / 1000 / 60);
            return integer;
        } else {
            return null;
        }
    }
}